home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / memometr / part01 next >
Encoding:
Internet Message Format  |  1990-04-15  |  52.3 KB

  1. Path: wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i148: MemMometer 2.1 - memory fragmentation gauge, Part01/02
  5. Message-ID: <12220@xanth.cs.odu.edu>
  6. Date: 15 Apr 90 14:50:17 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: hull@hao.ucar.edu (Howard Hull)
  9. Lines: 1226
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: hull@hao.ucar.edu (Howard Hull)
  15. Posting-number: Volume 90, Issue 148
  16. Archive-name: util/memmometer-2.1/part01
  17.  
  18. Mem Mometer - a memory fragmentation and modification detector gauge inspired
  19. by Tom Rokicki's WFrags and Peter DaSilva's Gauge program (Fred Fish #111)
  20. Following is an extract from the ReadMe file which details the history.
  21.  
  22. V2.1 - Some changes to the 8 color workbench color table to improve the
  23. ability to recognize 0xffffffff checksums and to better conform with CBM
  24. Workbench colors, and some corrections to inaccuracies in the documentation.
  25. Because it was possible to reach the forbidden processor read-toggle type
  26. addresses through selecting severely maligned Fast memory base values, a
  27. call to a requester which asks, Do-you-really-want-to-risk-doing-this???
  28. was inserted for the Fast memory base Warps menu as well as the Slow-Fast
  29. memory Warps menus.  The requester was also fixed to open with a link to
  30. the MemMometer window (titled "F") rather than to an underlying dummy req
  31. window (titled "Mem Mometer").  While it renders the title a trifle obscure,
  32. it limits the resource request to one requester-sized window rather than two.
  33.  
  34. #!/bin/sh
  35. # This is a shell archive.  Remove anything before this line, then unpack
  36. # it by saving it into a file and typing "sh file".  To overwrite existing
  37. # files, type "sh file -c".  You can also feed this as standard input via
  38. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  39. # will see the following message at the end:
  40. #        "End of archive 1 (of 2)."
  41. # Contents:  ReadMe makefile mm.doc mm.h mminit.c
  42. # Wrapped by tadguy@xanth on Sun Apr 15 10:49:55 1990
  43. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  44. if test -f 'ReadMe' -a "${1}" != "-c" ; then 
  45.   echo shar: Will not clobber existing file \"'ReadMe'\"
  46. else
  47. echo shar: Extracting \"'ReadMe'\" \(2542 characters\)
  48. sed "s/^X//" >'ReadMe' <<'END_OF_FILE'
  49. XThis is MemMometer V2.1
  50. XPrevious versions of MemMometer were
  51. X    V1.0 - Distributed to Peter Da Silva and Tom Rokicki, sent to Fred Fish
  52. X           but was evidently not put on a Fish Disk.  Problems with this
  53. X           version of the program were that it used the Delay(Arrgh) function
  54. X           for timing, and that it had an unrestricted menu selection for
  55. X           Slow-Fast memory and Fast memory base that, with non-existent
  56. X           memory, would result in a crash without prior warning. Also, the
  57. X           codes for one, two, or three columns were separate, so it was
  58. X           issued as three independently compiled programs.
  59. X    V1.1 - Not Distributed.  Delay() function replaced by VBLANK timer code
  60. X           that was earlier submitted to Usenet by Andy Finkel.  (Although
  61. X           Andy is a member of the CBM Amiga programmer team, the use of
  62. X           his codes in MemMometer do not in any way constitute an approval
  63. X           of the program on his part, of course.)
  64. X    V2.0 - Not Distributed.  A Menu item was added for setting MemMometer's
  65. X           running priority.  A Requester was  added to inform the user that
  66. X           Slow-Fast memory selections in Warps mode must be physically
  67. X           correct to avoid a system-fatal Guru 4 illegal instruction
  68. X           exception trap (or worse), see the documentation for details.
  69. X    V2.1 - Some changes to the 8 color workbench color table to improve the
  70. X           ability to recognize 0xffffffff checksums and to better conform
  71. X           with CBM Workbench colors, and some corrections to inaccuracies
  72. X           in the documentation.  Because it was possible to reach the (ahem)
  73. X           forbidden processor read-toggle type addresses through selecting
  74. X           severely maligned Fast memory base values, a call to the requester
  75. X           was additionally inserted for the Fast memory base menu.  The
  76. X           requester was also fixed to open with a link to the MemMometer
  77. X           window (titled "F") rather than to an underlying dummy window
  78. X           (titled "Mem Mometer").  While it renders the title a trifle
  79. X           obscure, it limits the resource request to one requester-sized
  80. X           window rather than two.
  81. X
  82. XFiles included in this package with names like whatever_info are icons;
  83. Xthey can be pressed into service wherever needed by substituting point
  84. Xfor underbar in the file name.
  85. X
  86. X                                                        Howard Hull
  87. X                                                        hull@ncar.ucar.edu
  88. X
  89. END_OF_FILE
  90. if test 2542 -ne `wc -c <'ReadMe'`; then
  91.     echo shar: \"'ReadMe'\" unpacked with wrong size!
  92. fi
  93. # end of 'ReadMe'
  94. fi
  95. if test -f 'makefile' -a "${1}" != "-c" ; then 
  96.   echo shar: Will not clobber existing file \"'makefile'\"
  97. else
  98. echo shar: Extracting \"'makefile'\" \(119 characters\)
  99. sed "s/^X//" >'makefile' <<'END_OF_FILE'
  100. XMM: mm.o mminit.o
  101. X    ln mm.o mminit.o -lc -o MM
  102. X
  103. Xmm.o: mm.h mm.c
  104. X    cc mm.c
  105. X
  106. Xmminit.o: mm.h mminit.c
  107. X    cc mminit.c
  108. END_OF_FILE
  109. if test 119 -ne `wc -c <'makefile'`; then
  110.     echo shar: \"'makefile'\" unpacked with wrong size!
  111. fi
  112. # end of 'makefile'
  113. fi
  114. if test -f 'mm.doc' -a "${1}" != "-c" ; then 
  115.   echo shar: Will not clobber existing file \"'mm.doc'\"
  116. else
  117. echo shar: Extracting \"'mm.doc'\" \(20567 characters\)
  118. sed "s/^X//" >'mm.doc' <<'END_OF_FILE'
  119. X/*
  120. X *   Information for MM Version 2.10, 24-Mar-1990
  121. X *
  122. X *   MemMometer - A program hacked from Tom Rokicki's WFrags more or less...
  123. X *   (in fact, a heck of a lot) in the style of Peter Da Silva's "Gauge."
  124. X *   The program opens a narrow window with the same dimensions as the
  125. X *   disk capacity gadget found in the top-level workbench window for
  126. X *   a floppy volume.  The sizing gadget is like the one in Gauge; to
  127. X *   resize the window, just click the left mouse button over the "E".
  128. X *   The "F" is the program title in this rather short manifestation of
  129. X *   an Amiga Intuition window drag bar.
  130. X *
  131. X *   My bin copy of Gauge broke when I put a Michigan Insider in my A1000.
  132. X *   I did not have source for the Gauge program, so I conjured this one.
  133. X *   To my chagrin, MM 1.0 broke when I got a 2000 (more on that shortly),
  134. X *   so I can hardly wait to see what the 3000 does to this version...
  135. X *   Changes with this version include a Priority menu item, automatic
  136. X *   column configuration of from one to three columns, compatibility
  137. X *   with the eight-color workbench, and timing via VBLANK signals from
  138. X *   the timer.device, replacing the notorious Delay(arrrgh) function
  139. X *   suspected to be linked with the treacherous floppy disk track 40
  140. X *   wipeout syndrome.  With the 2.10 version, the colors have been set
  141. X *   to more closely conform with the CBM workbench colors, the warps
  142. X *   recognition algorithm has been modified to detect a bitwise logical
  143. X *   true condition (0xffffffff) in addition to the usual bitwise and
  144. X *   otherwise logical false condition (0x00000000), and the titled crash
  145. X *   warning requester has been simplified at the expense of getting just
  146. X *   the title "F", but with the gain of not having the dummy window under
  147. X *   the requester.
  148. X *   
  149. X *   MemMometer may be started from an icon, a CLI, or the Run command
  150. X *   from a CLI.  MM uses dynamic allocation for its display data, and
  151. X *   does its own resource tracking.  MM will surrender any resources
  152. X *   which it has successfully obtained from allocation requests if,
  153. X *   while MM is running, requested resources are denied.  This type
  154. X *   of fault (exit code 20) proceeds silently, and without prior notice.
  155. X *
  156. X *   Now for a run through MemMometer's menu mechanics.  MemMometer opens
  157. X *   with a non-interlaced-screen-height narrow window at the left side of
  158. X *   the Workbench screen.  The window width is the same as the width of the
  159. X *   capacity gauge which Workbench renders at the left side of the top
  160. X *   level window for a floppy volume.  As with Peter Da Silva's gauge, the
  161. X *   MemMometer has an E at the bottom of the window, and an F at the top.
  162. X *   The E and the F are respectively, the window sizing gadget, and the
  163. X *   window titlebar.  New this version, the sizing gadget color identifies
  164. X *   the program MODE, and the title color reveals the selected memory
  165. X *   configuration.  While MemMometer can and does automatically arrange
  166. X *   the window to suit the memory configuration, it depends on the user to
  167. X *   select appropriate memory size and address values via the menus.  The
  168. X *   menu style is the usual Amiga Intuition menu set; selection is achieved
  169. X *   by clicking the left mouse button while the mouse pointer is anywhere
  170. X *   within the program's window boundary, and then activating the menu bar
  171. X *   by holding down the right mouse button and sliding the mouse pointer
  172. X *   along the Workbench screen title bar at the top of the Workbench screen.
  173. X *
  174. X *   At the left side of the Workbench screen title is the Project Menu.  The
  175. X *   Project Menu has three options.  The first option is "Front", which is a
  176. X *   window-to-front command for the event that the MM window was partially
  177. X *   buried by the opening of new windows after MM was invoked.   If the
  178. X *   right mouse button is released while the mouse pointer is directly over
  179. X *   the Front menu item, the MM window will oblige by popping forward to an
  180. X *   unobstructed view.  The second menu option is the "Back" item, which
  181. X *   will move the MM window back behind any other windows that have been
  182. X *   opened on the Workbench screen (with exception of a backdrop window).
  183. X *   The third Project menu option is the "Quit" option, which directs MM to
  184. X *   close its window and release the AmigaDOS resources MM has allocated.
  185. X *   The normal return code is zero.
  186. X *
  187. X *   The second Intuition menu is the Setup menu.  There are two Setup menu
  188. X *   items.  The first item is the "Mode" item.  MM has two modes, and they
  189. X *   are selected by sliding the mouse pointer straight down from the screen
  190. X *   title bar over the Mode item , and then moving the pointer to the right
  191. X *   as the mode submenu is activated.  The activated submenu provides two
  192. X *   choices, "Frags" and "Warps".  Frags are rather much the same as they
  193. X *   were in Da Silva's gauge program.  "Frags" is the default menu selection
  194. X *   with which MM is first initialized.  The Frags display is described in
  195. X *   the following table:
  196. X *   
  197. X *               2-Color Workbench    4-Color Workbench    8-Color Workbench
  198. X *  Unallocated        Blue                 Black                Black
  199. X *  Allocated          White                Orange               Yellow
  200. X *  Fragmented         Blue                 Blue                 Blue 
  201. X *
  202. X *   Unallocated memory is free memory available to programs.  The programs
  203. X *   may obtain this memory from AmigaDOS through allocation requests.  The
  204. X *   Allocated memory is memory assigned to programs running under AmigaDOS.
  205. X *   Fragmented memory consists of interleaved small memhunks, some of which
  206. X *   are assigned to programs and some of which are in the free memory pool.
  207. X *   The smallest fragments are 8 bytes, and the largest memhunks may be more
  208. X *   than a megabyte.  The fragmented class is assigned when, in making the
  209. X *   MM window display, a single horizontal pixel line was found to represent
  210. X *   both allocated and unallocated memhunks.  For this reason, for a full
  211. X *   window height MemMometer, the resolution of the fragmentation is shown
  212. X *   in more detail on interlaced Amiga Workbench screens.
  213. X *
  214. X *   The second mode item selection is the "Warps" mode.  While the Frags
  215. X *   mode is usually utilized as a low-priority background indicator, the
  216. X *   Warps mode is usually utilized at a somewhat higher priority for the
  217. X *   purpose of tracking bugs and system irregularities.  In this context,
  218. X *   I define warps as a form of discretized sample-to-sample differencing
  219. X *   function for some arbitrary segment of memory.  Warps are determined by
  220. X *   dividing the selected address space evenly among the MemMometer display
  221. X *   pixels, computing an assignment checkfunction for each pixel line of the
  222. X *   display on the associated assigned memory space at some sample time, and
  223. X *   then, while retaining the previous pixel-by-pixel record, repeating the
  224. X *   same evaluation the second sample time and comparing the sequentially
  225. X *   determined checksums. A "checksum" is computed by means of a sequential
  226. X *   bit-wise eXclusive OR assignment.  This type of checksum can readily
  227. X *   detect zeroed or changed values.  In the table below, logical FALSE is
  228. X *   zero, logical TRUE is taken as 0xffffffff and VALUE is anything else.
  229. X *   Colors indicate the type of change.  Colors for the most part follow
  230. X *   the standard CBM workbench color set, shown as follows:
  231. X *   
  232. X *                    Pen #   Color           Pen #   Color
  233. X *                      0     Blue              4     Green
  234. X *                      1     White             5     Red
  235. X *                      2     Black             6     Cyan
  236. X *                      3     Orange            7     Yellow
  237. X *
  238. X *   These colors are used to map the changes in memory content from sample
  239. X *   to sample as programs multitask together:
  240. X *
  241. X *   Condition        2-Color Workbench  4-Color Workbench  8-Color Workbench
  242. X *
  243. X *   VALUE ===> VALUE         Blue               Blue               Blue
  244. X *   VALUE =/=> VALUE         White              Orange             Orange
  245. X *   FALSE ===> FALSE         Blue               Black              Black
  246. X *   FALSE ---> VALUE         White              Orange             Yellow
  247. X *   VALUE ---> FALSE         White              White              Red
  248. X *   TRUE  ---> FALSE         Blue               Black              Cyan 
  249. X *   TRUE  ---> VALUE         Blue               Black              Cyan 
  250. X *   TRUE  ===> TRUE          Blue               Blue               Green
  251. X *   FALSE ---> TRUE          Blue               Blue               Green
  252. X *   VALUE ---> TRUE          Blue               Blue               Green
  253. X *
  254. X *   The second Setup menu item is a Frequency selection submenu.  While the
  255. X *   selected value does set a minimum frequency with which the memory state
  256. X *   will be examined, it's done by introducing a delay between measurements.
  257. X *   The introduced delay will be equal in seconds to the value selected in
  258. X *   the submenu.  The delay is accomplished by the AmigaDOS timer.device
  259. X *   using the VBLANK mode.  It was not thought worth the difficulty to make
  260. X *   the timing as precise as would be possible using the cia.resource, as
  261. X *   that might make the resource less useful to other programs, and as well
  262. X *   would mean extra effort adjusting for memory size-dependent scan times
  263. X *   from the various memory sizes selectable with the MM program.  Delay
  264. X *   intervals of 1, 2, 5, and 10 seconds are available.
  265. X *
  266. X *   The third Intuition menu is a Priority menu.  This menu applies only to
  267. X *   the MemMometer program and its associated CLI process.  Initially it is
  268. X *   at priority 0 with the expectation that the user will set it lower once
  269. X *   the program is running, in order to give more time to the other active
  270. X *   processes the user will be running.  A value of -50 is recommended.  In
  271. X *   the event the Priority of MM is changed via the menu, the CLI inherits
  272. X *   MemMometer's new priority and retains that priority even after MM quits.
  273. X *   Thus, with extreme priority settings, it may be better to "Run MM" to
  274. X *   keep from passing the extreme priority to subsequent processes spawned
  275. X *   from the CLI that was used to invoke MemMometer.  Also, go easy with the
  276. X *   positive priorities; remember that with AmigaDOS version 1.3 the DOS
  277. X *   input.device runs priority 20, FileSystem is priority 10, and the CON:
  278. X *   and trackdisk.device are priority 5 usually.  The first three menu items
  279. X *   are used to increment or decrement a selected priority.  Selection of
  280. X *   the "NORM" menu item removes any increment or decrement setting.
  281. X *
  282. X *   The remaining Intuition menu selections are provided so that the range
  283. X *   and base address of the memory examined may be adjusted for the user's
  284. X *   Amiga memory configuration.  Note that the base address must always be
  285. X *   set to the correct base address for the given memory configuration, but
  286. X *   that the range may be adjusted to give a better resolution for the first
  287. X *   segments above the base address, if desired.  Menus are provided for
  288. X *   Chip memory, Slow-Fast (C00000/Ranger) memory, and Fast memory.  While I
  289. X *   have had no difficulty as a result of selecting a range of memory that
  290. X *   involved a non-existent seqment for Chip or Fast memory, when I selected
  291. X *   non-existent SFMemory on my Fat Agnus Amiga 2000, it resulted in a total
  292. X *   system-wide big red Guru 4 (illegal instruction exception).
  293. X *
  294. X *   After that, I decided to post a requester for the user that issues a
  295. X *   terse a warning that a crash is _possible_ with incorrectly specified
  296. X *   Slow-Fast (non-existent) memory.  Since it is possible to access this
  297. X *   forbidden zone through inappropriate settings of the Fast Mem base, MM
  298. X *   also calls the requester if the Fast Mem base is changed. The requester
  299. X *   displays the message:
  300. X *
  301. X *                        WARNING! CRASH POSSIBLE
  302. X *                      MENU MEMORY SELECTIONS MUST
  303. X *                       REFERENCE EXISTING MEMORY
  304. X *
  305. X *                   Risk It                  Retreat
  306. X *
  307. X *   You don't have to worry about a crash if you really have an amount of
  308. X *   Slow-Fast memory equal or greater than the amount you specified in the
  309. X *   menu selection, and the base address is what you specified (the default
  310. X *   base address is C00000).  I'm sorry to have to do this, but I don't want
  311. X *   to put in code that monkeys with AmigaDOS's handling of the exception
  312. X *   vectors.  I feel justified, though, since my code does not change with
  313. X *   the type of memory segment examined; AmigaDOS evidently does have code
  314. X *   that handles the exceptions properly for the other memory segments.
  315. X *   So, here you see the two options.  The left button says - Risk It - a
  316. X *   comfortable gamble if you know your Slow-Fast memory configuration.
  317. X *   Pre Fat-Agnus Amiga 2000 machines have 512K of Slow-Fast memory.  Newer
  318. X *   Amiga 2000 machines have no Slow Fast memory - so beware of this and try
  319. X *   it when you have nothing else going on.  The - Retreat - option sets
  320. X *   the SFMemory Size internal to the MemMometer program to zero and clears
  321. X *   the display.  (It does leave the menu items checked, though, so you will
  322. X *   have to remember to re-select suitable menu values in order to get the
  323. X *   display to show something in each existing memory type.  For Chip and
  324. X *   Fast memory this will simply entail going back into the menu and again
  325. X *   selecting whatever was previously checked.  The Slow-Fast memory size
  326. X *   should then be set either to appropriate values or to "NONE".)
  327. X *   
  328. X *   Note that in the display there may at any time be anywhere from one
  329. X *   to three MemMometers - for Chip (left-hand column), another for the
  330. X *   Slow Fast mem (center column) and yet another for Fast mem (right-hand
  331. X *   column).  These MemMometers can be turned on or off as desired by
  332. X *   selecting "NONE" or the various items in the Size menus.
  333. X *
  334. X *   Parts of several freely distributable  programs have been used to make
  335. X *   MemMometer.  Menus, for instance, are done in the style VT100 (Wecker,
  336. X *   et al).  As with the VT100 program, MemMometer has preset variables.
  337. X *   However, the program does not yet contain a script file reader or an
  338. X *   AREXX interface with which to automatically set the variables.  Likely
  339. X *   it is that I'll write the code for that some time this century!
  340. X *
  341. X *   MemMometer uses forbid() and permit() when it examines the mem list in
  342. X *   Frags mode.  I suppose it is possible with large amounts of memory to
  343. X *   scan, that some gross treachery can happen while the list is locked.
  344. X *   However, with my 3 meg Amiga 2000 I've not seen it.  It takes a while
  345. X *   after startup to settle out and display the large byte counts associated
  346. X *   with Fast mem, so be patient...  MemMometer is most useful for finding
  347. X *   out why large programs won't load.  It's also useful in development for
  348. X *   seeing the impact your application is having on memory fragmentation.
  349. X *   The Warps mode displays any change it sees in memory from one sample
  350. X *   to the next; BUT this mode only works sensibly when JUST ONE memory size
  351. X *   selection is active (set others to "NONE").  The memory space is scanned
  352. X *   asynchronously, so it can have sample alias difficulties.  However, the
  353. X *   Warps mode does not use forbid(), permit(), enable(), disable(), or any
  354. X *   other constrictive system call.  I just does a lot of read-only memory
  355. X *   cycles and writes the result in its own dynamically allocated memory
  356. X *   space.
  357. X *
  358. X *   To run MemMometer, simply type
  359. X *
  360. X *      run MM
  361. X *
  362. X *      or  click on the icon.
  363. X *
  364. X *   Then open the menu item selections and set them for your configuration.
  365. X *   Frags mode, and 512K of CHIP @0, 0 Meg of Fast mem @ 200000, 0 Meg of
  366. X *   SF mem @ @C00000 are the defaults.  The modes selected are color coded
  367. X *   into the "F" and "E" indicators:
  368. X *
  369. X *   Mode       Indicator       2 color WB      4 Color WB      8 Color WB
  370. X *
  371. X *   Frags          E                Blue            Blue            Blue
  372. X *   Warps          E                White           Orange          Yellow
  373. X *
  374. X *   One column:
  375. X *   Chip           F                Blue            Blue            Blue  
  376. X *   Slow-Fast      F                Blue            Black           Cyan
  377. X *   Fast           F                White           Orange          Yellow
  378. X *
  379. X *   Two columns:
  380. X *   Chip +SF       F                Blue            Blue            Blue
  381. X *   Chip +Fast     F                Blue            Black           Cyan
  382. X *   SF + Fast      F                White           Orange          Yellow
  383. X *
  384. X *   Three columns:
  385. X *   C + SF + Fast  F                Blue            Blue            Blue
  386. X *   None           F                White           Orange          Orange
  387. X *
  388. X *   The source code included with this distribution was compiled with the
  389. X *   Manx Aztec C compiler, version 3.6a in 16-bit integer mode.  Numerous
  390. X *   type casts in the code, as well as other non-alignments with the Lattice
  391. X *   environment would make compilation under versions of Lattice difficult.
  392. X *   Sorry.  Compilation instructions are of course in the makefile included
  393. X *   in the distribution.
  394. X *
  395. X *   About my part of C code - it wasn't done for speed, as I am sure you can
  396. X *   tell.  If I wanted speed I would have used assembly language.  It also
  397. X *   likely isn't elegant code, by a long shot (unless it's the part I got
  398. X *   from Rokicki's WFrags).  But assembly language is time-consuming to
  399. X *   write, so that won't happen any time soon.  Maybe the next thing will be
  400. X *   the AREXX port - so that other programs can specify a low address and a
  401. X *   byte count range for one of the MemMometers to display (say, within the
  402. X *   specified menu selection span).  Gross comments about the code or bug
  403. X *   reports may be e-mailed to me at the site domain specified below.
  404. X *
  405. X *   About everyone else's C code in MM - Let's see, VT100 (Wecker et al) has
  406. X *   been freely distributable since the early days of the Amiga.  When VT100
  407. X *   was first posted, Wecker did not prepend a copyright to the code.  He
  408. X *   later discovered that his employer (DEC) routinely required employees to
  409. X *   sign a contract statement which granted to DEC all rights with respect
  410. X *   to codes written by DEC employees, whether the codes were written on the
  411. X *   company's time/facilities or otherwise.  I do not know how the matter
  412. X *   was resolved, but VT100 still seems to be on the freely distributable
  413. X *   software list; the VT100 codes, now with parts from many contributors,
  414. X *   are currently maintained by Antony C. Sumrall (acs@ahmdahl.com).  The
  415. X *   menus in MM, while styled with the same code forms as were used with
  416. X *   VT100 v2.3, are of course different in content in any case.  The WFrags
  417. X *   program was, I believe, a version by Tom Rokicki (the Amiga Tex guy)
  418. X *   probably evolved from the Frags program originally submitted to the net
  419. X *   by Mike Meyer.  WFrags was submitted to the net without a prepended
  420. X *   copyright notice, evidently intended  as freely distributable software.
  421. X *
  422. X *   The spirit of these contributions is that they are not to be used for
  423. X *   commercial purposes, and the original authors certainly appreciate
  424. X *   being cited for their work.  So I just did that.  The timer codes are
  425. X *   exerpted from a network article by Andy Finkel of CBM, submitted as a
  426. X *   demonstration of the ease of implementing the Amiga timer.device in C.
  427. X *   There are supposedly at least two ways to implement the timer.device,
  428. X *   either as a message port to the Amiga Exec, or as an IDCMP feature in
  429. X *   Amiga Intuition.  It would seem that the latter would be better for a
  430. X *   program (such as this one) which makes resolute use of Intuition IDCMP
  431. X *   features.  However, Andy's code was for the former, and rather than do
  432. X *   whatever would have been required to utilize the IDCMP TIMER flag, I
  433. X *   just went with what Andy originally wrote.  So, for my part, I add no
  434. X *   further restrictions to the codes in MM, though I expect everyone must
  435. X *   regard the MM code as owned by Rokicki - even if he is not in any way
  436. X *   responsible for maintaining the codes or controlling the result of their
  437. X *   use.  Thus, I submit the following Standard Disclaimer:
  438. X *
  439. X *   The authors accept no responsibility for anything either beneficial or
  440. X *   detrimental that may happen as a result of using the codes in MM.  The
  441. X *   codes are intended for non-commercial use only.
  442. X *   
  443. X *
  444. X *   Howard Hull  hull@ncar.ucar.edu
  445. X *
  446. X */
  447. END_OF_FILE
  448. if test 20567 -ne `wc -c <'mm.doc'`; then
  449.     echo shar: \"'mm.doc'\" unpacked with wrong size!
  450. fi
  451. # end of 'mm.doc'
  452. fi
  453. if test -f 'mm.h' -a "${1}" != "-c" ; then 
  454.   echo shar: Will not clobber existing file \"'mm.h'\"
  455. else
  456. echo shar: Extracting \"'mm.h'\" \(757 characters\)
  457. sed "s/^X//" >'mm.h' <<'END_OF_FILE'
  458. X/* : ai=0 bk=0 ts=8 */
  459. X#include <intuition/intuition.h>
  460. X#include <intuition/intuitionbase.h>
  461. X#include <graphics/gfx.h>
  462. X#include <graphics/gfxbase.h>
  463. X#include <exec/exec.h>
  464. X#include <exec/execbase.h>
  465. X#include <functions.h>
  466. X
  467. X/* standard and suggested Workbench pen colors */
  468. X
  469. X#define BLUP 0L        /* CBM Workbench medium (IBM) blue */
  470. X#define WHTP 1L        /* CBM Workbench pure white */
  471. X#define BLKP 2L        /* CBM Workbench black with elevated blue */
  472. X#define ORNP 3L        /* CBM Workbench orange */
  473. X#define GRNP 4L        /* CBM Workbench pure blue */
  474. X#define REDP 5L        /* CBM Workbench magenta */
  475. X#define CYNP 6L        /* CBM Workbench cyan */
  476. X#define YELP 7L        /* CBM Workbench duplicates white here */
  477. X
  478. Xextern struct Window *window ;
  479. X
  480. END_OF_FILE
  481. if test 757 -ne `wc -c <'mm.h'`; then
  482.     echo shar: \"'mm.h'\" unpacked with wrong size!
  483. fi
  484. # end of 'mm.h'
  485. fi
  486. if test -f 'mminit.c' -a "${1}" != "-c" ; then 
  487.   echo shar: Will not clobber existing file \"'mminit.c'\"
  488. else
  489. echo shar: Extracting \"'mminit.c'\" \(23918 characters\)
  490. sed "s/^X//" >'mminit.c' <<'END_OF_FILE'
  491. X/* : ai=0 bk=0 ts=8 */
  492. X#include "mm.h"
  493. X
  494. X#define PROJMAX 3               /* number of project menu items */
  495. X#define SETUPMAX 2              /* number of setup menu items */
  496. X#define MODEMAX 2
  497. X#define FREQMAX 4               /* number of frequency menu items */
  498. X#define PRIOMAX 16              /* number of priority menu items */
  499. X#define CHIPMAX 5               /* number of chip mem size menu items */
  500. X#define CHIPAMAX 4              /* number of chip mem base addr menu items */
  501. X#define SFMAX 4                 /* number of sf mem size menu items */
  502. X#define SFAMAX 4                /* number of sf mem base addr menu items */
  503. X#define FASTMAX 7               /* number of fast mem size menu items */
  504. X#define FASTAMAX 8              /* number of fast mem base addr menu items */
  505. X#define MAXMENU 9               /* total number of top level menus */
  506. X
  507. Xextern BOOL p_mode;             /* preset frags mode = 0, warps mode = 1 */
  508. Xextern long p_rate;             /* preset sample interval, secs see menu */
  509. Xextern long p_priority;         /* preset priority, range -100 to +100   */
  510. Xextern long p_chip;             /* preset chip mem size, kbytes see menu */
  511. Xextern long p_chipa;            /* preset chip mem address, kb  see menu */
  512. Xextern long p_sf;               /* preset slowfast mem size, kb see menu */
  513. Xextern long p_sfa;              /* preset slowfast mem addr, kb see menu */
  514. Xextern long p_fast;             /* preset fast mem size, mbytes see menu */
  515. Xextern long p_fasta;            /* preset fast mem addr, mbytes see menu */
  516. X
  517. X/******************************************************/
  518. X/*    Structure declarations for the menu sections    */
  519. X/******************************************************/
  520. X
  521. Xstruct   MenuItem ProjItem[PROJMAX];
  522. Xstruct   IntuiText ProjText[PROJMAX];
  523. Xstruct   MenuItem SetupItem[SETUPMAX];
  524. Xstruct   IntuiText SetupText[SETUPMAX];
  525. Xstruct   MenuItem ModeItem[MODEMAX];
  526. Xstruct   IntuiText ModeText[MODEMAX];
  527. Xstruct   MenuItem FreqItem[FREQMAX];
  528. Xstruct   IntuiText FreqText[FREQMAX];
  529. Xstruct   MenuItem PrioItem[PRIOMAX];
  530. Xstruct   IntuiText PrioText[PRIOMAX];
  531. Xstruct   MenuItem ChipItem[CHIPMAX];
  532. Xstruct   IntuiText ChipText[CHIPMAX];
  533. Xstruct   MenuItem ChipAItem[CHIPAMAX];
  534. Xstruct   IntuiText ChipAText[CHIPAMAX];
  535. Xstruct   MenuItem SFItem[SFMAX];
  536. Xstruct   IntuiText SFText[SFMAX];
  537. Xstruct   MenuItem SFAItem[SFAMAX];
  538. Xstruct   IntuiText SFAText[SFAMAX];
  539. Xstruct   MenuItem FastItem[FASTMAX];
  540. Xstruct   IntuiText FastText[FASTMAX];
  541. Xstruct   MenuItem FastAItem[FASTAMAX];
  542. Xstruct   IntuiText FastAText[FASTAMAX];
  543. Xstruct   Menu menu[MAXMENU];
  544. X
  545. X/*****************************************************************/
  546. X/*    The following function initializes the structure arrays    */
  547. X/*    needed to provide the Project menu topic.                  */
  548. X/*    this was left retro-compatible with Manx 3.4a (nplus1)     */
  549. X/*****************************************************************/
  550. Xvoid InitProjItems()
  551. X    {
  552. X    int       n,nplus1;
  553. X
  554. X/* initialize each menu item and IntuiText with loop */
  555. Xfor( n=0; n<PROJMAX; n++ )
  556. X    {
  557. X    nplus1 = n + 1;
  558. X    ProjItem[n].NextItem = &ProjItem[nplus1];
  559. X    ProjItem[n].LeftEdge = 0;
  560. X    ProjItem[n].TopEdge = 9 * n;
  561. X    ProjItem[n].Width = 64;
  562. X    ProjItem[n].Height = 9;
  563. X    ProjItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
  564. X    ProjItem[n].MutualExclude = 0;
  565. X    ProjItem[n].ItemFill = (APTR)&ProjText[n];
  566. X    ProjItem[n].SelectFill = NULL;
  567. X    ProjItem[n].Command = 0;
  568. X    ProjItem[n].SubItem = NULL;
  569. X    ProjItem[n].NextSelect = 0;
  570. X
  571. X    ProjText[n].FrontPen = BLUP;
  572. X    ProjText[n].BackPen = WHTP;
  573. X    ProjText[n].DrawMode = JAM2;/* render in fore and background */
  574. X    ProjText[n].LeftEdge = 0;
  575. X    ProjText[n].TopEdge = 1;
  576. X    ProjText[n].ITextFont = NULL;
  577. X    ProjText[n].NextText = NULL;
  578. X    }
  579. XProjItem[PROJMAX-1].NextItem = NULL;
  580. X
  581. X/* initialize text for specific menu items */
  582. X
  583. XProjText[0].IText = (UBYTE *)"Front";
  584. XProjText[1].IText = (UBYTE *)"Back";
  585. XProjText[2].IText = (UBYTE *)"Quit";
  586. X}
  587. X
  588. X/*****************************************************************/
  589. X/*    The following initializes the structure arrays             */
  590. X/*   needed to provide the Setup menu topic.                     */
  591. X/*****************************************************************/
  592. X
  593. Xvoid InitSetupItems()
  594. X    {
  595. X    int       n,nplus1;
  596. X
  597. X/* initialize each menu item and IntuiText with loop */
  598. Xfor( n=0; n<SETUPMAX; n++ )
  599. X    {
  600. X    nplus1 = n + 1;
  601. X    SetupItem[n].NextItem = &SetupItem[nplus1];
  602. X    SetupItem[n].LeftEdge = 0;
  603. X    SetupItem[n].TopEdge = 9 * n;
  604. X    SetupItem[n].Width = 44;
  605. X    SetupItem[n].Height = 9;
  606. X    SetupItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP ;
  607. X    SetupItem[n].MutualExclude = 0;
  608. X    SetupItem[n].ItemFill = (APTR)&SetupText[n];
  609. X    SetupItem[n].SelectFill = NULL;
  610. X    SetupItem[n].Command = 0;
  611. X    SetupItem[n].NextSelect = 0;
  612. X
  613. X    SetupText[n].FrontPen = BLUP;
  614. X    SetupText[n].BackPen = WHTP;
  615. X    SetupText[n].DrawMode = JAM2;    
  616. X    SetupText[n].LeftEdge = 0;
  617. X    SetupText[n].TopEdge = 1;
  618. X    SetupText[n].ITextFont = NULL;
  619. X    SetupText[n].NextText = NULL;
  620. X    }
  621. XSetupItem[SETUPMAX-1].NextItem = NULL;
  622. X
  623. XSetupText[0].IText = (UBYTE *)"Mode";
  624. XSetupItem[0].SubItem = ModeItem;
  625. XSetupText[1].IText = (UBYTE *)"Freq";
  626. XSetupItem[1].SubItem = FreqItem;
  627. X
  628. X/*****************************************************************/
  629. X/*    The following initializes the structure arrays             */
  630. X/*   needed to provide the Mode submenu topic.                   */
  631. X/*****************************************************************/
  632. X
  633. Xfor( n=0; n<MODEMAX; n++ )
  634. X    {
  635. X    nplus1 = n + 1;
  636. X    ModeItem[n].NextItem = &ModeItem[nplus1];
  637. X    ModeItem[n].LeftEdge = 38;
  638. X    ModeItem[n].TopEdge = 9 * n;
  639. X    ModeItem[n].Width = 72;
  640. X    ModeItem[n].Height = 9;
  641. X    ModeItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  642. X    ModeItem[n].MutualExclude = (~(1 << n));
  643. X    ModeItem[n].ItemFill = (APTR)&ModeText[n];
  644. X    ModeItem[n].SelectFill = NULL;
  645. X    ModeItem[n].Command = 0;
  646. X    ModeItem[n].SubItem = NULL;
  647. X    ModeItem[n].NextSelect = 0;
  648. X
  649. X    ModeText[n].FrontPen = BLUP;
  650. X    ModeText[n].BackPen = WHTP;
  651. X    ModeText[n].DrawMode = JAM2;     /* render in fore and background */
  652. X    ModeText[n].LeftEdge = 0;
  653. X    ModeText[n].TopEdge = 1;
  654. X    ModeText[n].ITextFont = NULL;
  655. X    ModeText[n].NextText = NULL;
  656. X    }
  657. XModeItem[MODEMAX-1].NextItem = NULL;
  658. X
  659. X/* select mode subitem checked */
  660. Xswitch (p_mode) {
  661. X    case 0:     n = 0; break;
  662. X    case 1:     n = 1; break;
  663. X    default:    n = 1; p_mode = FALSE;
  664. X    }
  665. XModeItem[n].Flags |= CHECKED;
  666. X
  667. X/* initialize text for specific submenu items */
  668. XModeText[0].IText = (UBYTE *)"   Frags";
  669. XModeText[1].IText = (UBYTE *)"   Warps";
  670. X
  671. X/*****************************************************************/
  672. X/*    The following initializes the structure arrays             */
  673. X/*   needed to provide the Freq submenu topic.                   */
  674. X/*****************************************************************/
  675. X
  676. Xfor( n=0; n<FREQMAX; n++ )
  677. X    {
  678. X    nplus1 = n + 1;
  679. X    FreqItem[n].NextItem = &FreqItem[nplus1];
  680. X    FreqItem[n].LeftEdge = 38;
  681. X    FreqItem[n].TopEdge = 9 * n;
  682. X    FreqItem[n].Width = 88;
  683. X    FreqItem[n].Height = 9;
  684. X    FreqItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  685. X    FreqItem[n].MutualExclude = (~(1 << n));
  686. X    FreqItem[n].ItemFill = (APTR)&FreqText[n];
  687. X    FreqItem[n].SelectFill = NULL;
  688. X    FreqItem[n].Command = 0;
  689. X    FreqItem[n].SubItem = NULL;
  690. X    FreqItem[n].NextSelect = 0;
  691. X
  692. X    FreqText[n].FrontPen = BLUP;
  693. X    FreqText[n].BackPen = WHTP;
  694. X    FreqText[n].DrawMode = JAM2;     /* render in fore and background */
  695. X    FreqText[n].LeftEdge = 0;
  696. X    FreqText[n].TopEdge = 1;
  697. X    FreqText[n].ITextFont = NULL;
  698. X    FreqText[n].NextText = NULL;
  699. X    }
  700. XFreqItem[FREQMAX-1].NextItem = NULL;
  701. X
  702. X/* select frequency item checked */
  703. Xswitch (p_rate) {
  704. X    case 1:     n = 0; break;
  705. X    case 2:     n = 1; break;
  706. X    case 5:     n = 2; break;
  707. X    case 10:    n = 3; break;
  708. X    default:    n = 1; p_rate = 2;
  709. X    }
  710. XFreqItem[n].Flags |= CHECKED;
  711. X
  712. X/* initialize text for specific menu items */
  713. XFreqText[0].IText = (UBYTE *)"    1 Sec ";
  714. XFreqText[1].IText = (UBYTE *)"    2 Secs";
  715. XFreqText[2].IText = (UBYTE *)"    5 Secs";
  716. XFreqText[3].IText = (UBYTE *)"   10 Secs";
  717. X}
  718. X
  719. X/*****************************************************************/
  720. X/*    The following initializes the structure arrays             */
  721. X/*   needed to provide the Priority menu topic.                  */
  722. X/*****************************************************************/
  723. X
  724. Xvoid InitPrioItems()
  725. X    {
  726. X    int       n,nplus1;
  727. X
  728. X/* initialize each menu item and IntuiText with loop */
  729. Xfor( n=0; n<PRIOMAX; n++ )
  730. X    {
  731. X    nplus1 = n + 1;
  732. X    PrioItem[n].NextItem = &PrioItem[nplus1];
  733. X    PrioItem[n].LeftEdge = 0;
  734. X    PrioItem[n].TopEdge = 9 * n;
  735. X    PrioItem[n].Width = 80;
  736. X    PrioItem[n].Height = 9;
  737. X    PrioItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  738. X    PrioItem[n].MutualExclude = (~(1 << n));
  739. X    if (n < 3)  PrioItem[n].MutualExclude &= 0x0007;
  740. X    if (n < 1)  PrioItem[n].MutualExclude |= 0x0007;
  741. X    PrioItem[n].ItemFill = (APTR)&PrioText[n];
  742. X    PrioItem[n].SelectFill = NULL;
  743. X    PrioItem[n].Command = 0;
  744. X    PrioItem[n].NextSelect = 0;
  745. X
  746. X    PrioText[n].FrontPen = BLUP;
  747. X    PrioText[n].BackPen = WHTP;
  748. X    if (n > 11)  {
  749. X        PrioText[n].FrontPen = ORNP;
  750. X        PrioText[n].BackPen = REDP;
  751. X        }
  752. X    PrioText[n].DrawMode = JAM2;    
  753. X    PrioText[n].LeftEdge = 0;
  754. X    PrioText[n].TopEdge = 1;
  755. X    PrioText[n].ITextFont = NULL;
  756. X    PrioText[n].NextText = NULL;
  757. X    }
  758. XPrioItem[PRIOMAX-1].NextItem = NULL;
  759. X
  760. X/* select priority item checked */
  761. Xswitch (p_priority) {
  762. X    case  -99:     n =  3; break;
  763. X    case  -75:     n =  4; break;
  764. X    case  -50:     n =  5; break;
  765. X    case  -25:     n =  6; break;
  766. X    case  -20:     n =  7; break;
  767. X    case  -15:     n =  8; break;
  768. X    case  -10:     n =  9; break;
  769. X    case   -5:     n = 10; break;
  770. X    case    0:     n = 11; break;
  771. X    case    5:     n = 12; break;
  772. X    case   10:     n = 13; break;
  773. X    case   15:     n = 14; break;
  774. X    case   20:     n = 15; break;
  775. X    default:       n = 11; p_priority = 0;
  776. X    }
  777. XPrioItem[n].Flags |= CHECKED;
  778. X
  779. XPrioText[ 0].IText = (UBYTE *)"   NORM   ";
  780. XPrioText[ 1].IText = (UBYTE *)"   DECR   ";
  781. XPrioText[ 2].IText = (UBYTE *)"   INCR   ";
  782. XPrioText[ 3].IText = (UBYTE *)"   -99    ";
  783. XPrioText[ 4].IText = (UBYTE *)"   -75    ";
  784. XPrioText[ 5].IText = (UBYTE *)"   -50    ";
  785. XPrioText[ 6].IText = (UBYTE *)"   -25    ";
  786. XPrioText[ 7].IText = (UBYTE *)"   -20    ";
  787. XPrioText[ 8].IText = (UBYTE *)"   -15    ";
  788. XPrioText[ 9].IText = (UBYTE *)"   -10    ";
  789. XPrioText[10].IText = (UBYTE *)"   -5     ";
  790. XPrioText[11].IText = (UBYTE *)"    0     ";
  791. XPrioText[12].IText = (UBYTE *)"    5     ";
  792. XPrioText[13].IText = (UBYTE *)"    10    ";
  793. XPrioText[14].IText = (UBYTE *)"    15    ";
  794. XPrioText[15].IText = (UBYTE *)"    20    ";
  795. X}
  796. X
  797. X/*****************************************************************/
  798. X/*    The following initializes the structure arrays             */
  799. X/*   needed to provide the Chip Mem Size menu topic.             */
  800. X/*****************************************************************/
  801. X
  802. Xvoid InitChipItems()
  803. X    {
  804. X    int       n,nplus1;
  805. X
  806. X/* initialize each menu item and IntuiText with loop */
  807. Xfor( n=0; n<CHIPMAX; n++ )
  808. X    {
  809. X    nplus1 = n + 1;
  810. X    ChipItem[n].NextItem = &ChipItem[nplus1];
  811. X    ChipItem[n].LeftEdge = 0;
  812. X    ChipItem[n].TopEdge = 9 * n;
  813. X    ChipItem[n].Width = 80;
  814. X    ChipItem[n].Height = 9;
  815. X    ChipItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  816. X    ChipItem[n].MutualExclude = (~(1 << n));
  817. X    ChipItem[n].ItemFill = (APTR)&ChipText[n];
  818. X    ChipItem[n].SelectFill = NULL;
  819. X    ChipItem[n].Command = 0;
  820. X    ChipItem[n].NextSelect = 0;
  821. X
  822. X    ChipText[n].FrontPen = BLUP;
  823. X    ChipText[n].BackPen = WHTP;
  824. X    ChipText[n].DrawMode = JAM2;    
  825. X    ChipText[n].LeftEdge = 0;
  826. X    ChipText[n].TopEdge = 1;
  827. X    ChipText[n].ITextFont = NULL;
  828. X    ChipText[n].NextText = NULL;
  829. X    }
  830. XChipItem[CHIPMAX-1].NextItem = NULL;
  831. X
  832. X/* select chip mem size item checked */
  833. Xswitch (p_chip) {
  834. X    case    0:     n = 0; break;
  835. X    case  256:     n = 1; break;
  836. X    case  512:     n = 2; break;
  837. X    case 1024:     n = 3; break;
  838. X    case 2048:     n = 4; break;
  839. X    default:       n = 2; p_chip = 512;
  840. X    }
  841. XChipItem[n].Flags |= CHECKED;
  842. X
  843. XChipText[0].IText = (UBYTE *)"   NONE";
  844. XChipText[1].IText = (UBYTE *)"   256K";
  845. XChipText[2].IText = (UBYTE *)"   512K";
  846. XChipText[3].IText = (UBYTE *)"   1 MB";
  847. XChipText[4].IText = (UBYTE *)"   2 MB";
  848. X}
  849. X
  850. X/*****************************************************************/
  851. X/*    The following initializes the structure arrays             */
  852. X/*   needed to provide the Chip Base Addr menu topic.            */
  853. X/*****************************************************************/
  854. X
  855. Xvoid InitChipAItems()
  856. X    {
  857. X    int       n,nplus1;
  858. X
  859. X/* initialize each menu item and IntuiText with loop */
  860. Xfor( n=0; n<CHIPAMAX; n++ )
  861. X    {
  862. X    nplus1 = n + 1;
  863. X    ChipAItem[n].NextItem = &ChipAItem[nplus1];
  864. X    ChipAItem[n].LeftEdge = 0;
  865. X    ChipAItem[n].TopEdge = 9 * n;
  866. X    ChipAItem[n].Width = 80;
  867. X    ChipAItem[n].Height = 9;
  868. X    ChipAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  869. X    ChipAItem[n].MutualExclude = (~(1 << n));
  870. X    ChipAItem[n].ItemFill = (APTR)&ChipAText[n];
  871. X    ChipAItem[n].SelectFill = NULL;
  872. X    ChipAItem[n].Command = 0;
  873. X    ChipAItem[n].NextSelect = 0;
  874. X
  875. X    ChipAText[n].FrontPen = BLUP;
  876. X    ChipAText[n].BackPen = WHTP;
  877. X    ChipAText[n].DrawMode = JAM2;    
  878. X    ChipAText[n].LeftEdge = 0;
  879. X    ChipAText[n].TopEdge = 1;
  880. X    ChipAText[n].ITextFont = NULL;
  881. X    ChipAText[n].NextText = NULL;
  882. X    }
  883. XChipAItem[CHIPAMAX-1].NextItem = NULL;
  884. X
  885. X/* select chip base address item checked */
  886. Xswitch (p_chipa) {
  887. X    case    0:     n = 0; break;
  888. X    case  256:     n = 1; break;
  889. X    case  512:     n = 2; break;
  890. X    case 1024:     n = 3; break;
  891. X    default:       n = 0; p_chipa = 0;
  892. X    }
  893. XChipAItem[n].Flags |= CHECKED;
  894. X
  895. XChipAText[0].IText = (UBYTE *)"   @   0K";
  896. XChipAText[1].IText = (UBYTE *)"   @ 256K";
  897. XChipAText[2].IText = (UBYTE *)"   @ 512K";
  898. XChipAText[3].IText = (UBYTE *)"   @ 1 MB";
  899. X}
  900. X
  901. X/*****************************************************************/
  902. X/*    The following initializes the structure arrays             */
  903. X/*   needed to provide the Slow Fast Mem Size menu topic.        */
  904. X/*****************************************************************/
  905. X
  906. Xvoid InitSFItems()
  907. X    {
  908. X    int       n,nplus1;
  909. X
  910. X/* initialize each menu item and IntuiText with loop */
  911. Xfor( n=0; n<SFMAX; n++ )
  912. X    {
  913. X    nplus1 = n + 1;
  914. X    SFItem[n].NextItem = &SFItem[nplus1];
  915. X    SFItem[n].LeftEdge = 0;
  916. X    SFItem[n].TopEdge = 9 * n;
  917. X    SFItem[n].Width = 80;
  918. X    SFItem[n].Height = 9;
  919. X    SFItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  920. X    SFItem[n].MutualExclude = (~(1 << n));
  921. X    SFItem[n].ItemFill = (APTR)&SFText[n];
  922. X    SFItem[n].SelectFill = NULL;
  923. X    SFItem[n].Command = 0;
  924. X    SFItem[n].NextSelect = 0;
  925. X
  926. X    SFText[n].FrontPen = BLUP;
  927. X    SFText[n].BackPen = WHTP;
  928. X    SFText[n].DrawMode = JAM2;    
  929. X    SFText[n].LeftEdge = 0;
  930. X    SFText[n].TopEdge = 1;
  931. X    SFText[n].ITextFont = NULL;
  932. X    SFText[n].NextText = NULL;
  933. X    }
  934. XSFItem[SFMAX-1].NextItem = NULL;
  935. X
  936. X/* select slow fast mem size item checked */
  937. Xswitch (p_sf) {
  938. X    case    0:     n = 0; break;
  939. X    case  512:     n = 1; break;
  940. X    case 1024:     n = 2; break;
  941. X    case 1536:     n = 3; break;
  942. X    default:       n = 0; p_sf = 0;
  943. X    }
  944. XSFItem[n].Flags |= CHECKED;
  945. X
  946. XSFText[0].IText = (UBYTE *)"   NONE  ";
  947. XSFText[1].IText = (UBYTE *)"   0.5 MB";
  948. XSFText[2].IText = (UBYTE *)"   1   MB";
  949. XSFText[3].IText = (UBYTE *)"   1.5 MB";
  950. X}
  951. X
  952. X/*****************************************************************/
  953. X/*    The following initializes the structure arrays             */
  954. X/*   needed to provide the Slow Fast Mem Base Addr menu topic.   */
  955. X/*****************************************************************/
  956. X
  957. Xvoid InitSFAItems()
  958. X    {
  959. X    int       n,nplus1;
  960. X
  961. X/* initialize each menu item and IntuiText with loop */
  962. Xfor( n=0; n<SFAMAX; n++ )
  963. X    {
  964. X    nplus1 = n + 1;
  965. X    SFAItem[n].NextItem = &SFAItem[nplus1];
  966. X    SFAItem[n].LeftEdge = 0;
  967. X    SFAItem[n].TopEdge = 9 * n;
  968. X    SFAItem[n].Width = 104;
  969. X    SFAItem[n].Height = 9;
  970. X    SFAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  971. X    SFAItem[n].MutualExclude = (~(1 << n));
  972. X    SFAItem[n].ItemFill = (APTR)&SFAText[n];
  973. X    SFAItem[n].SelectFill = NULL;
  974. X    SFAItem[n].Command = 0;
  975. X    SFAItem[n].NextSelect = 0;
  976. X
  977. X    SFAText[n].FrontPen = BLUP;
  978. X    SFAText[n].BackPen = WHTP;
  979. X    SFAText[n].DrawMode = JAM2;    
  980. X    SFAText[n].LeftEdge = 0;
  981. X    SFAText[n].TopEdge = 1;
  982. X    SFAText[n].ITextFont = NULL;
  983. X    SFAText[n].NextText = NULL;
  984. X    }
  985. XSFAItem[SFAMAX-1].NextItem = NULL;
  986. X
  987. X/* select slow fast mem base address item checked */
  988. Xswitch (p_sfa) {
  989. X    case 12288:     n = 0; break;               /* 0x3000 kb = 12   mb */
  990. X    case 12800:     n = 1; break;               /* 0x3200 kb = 12.5 mb */
  991. X    case 13312:     n = 2; break;               /* 0x3400 kb = 13   mb */
  992. X    case 13824:     n = 3; break;               /* 0x3600 kb = 13.5 mb */
  993. X    default:        n = 0; p_sfa = 12288;
  994. X    }
  995. XSFAItem[n].Flags |= CHECKED;
  996. X
  997. XSFAText[0].IText = (UBYTE *)"   @ C.0 Meg";
  998. XSFAText[1].IText = (UBYTE *)"   @ C.8 Meg";
  999. XSFAText[2].IText = (UBYTE *)"   @ D.0 Meg";
  1000. XSFAText[3].IText = (UBYTE *)"   @ D.8 Meg";
  1001. X}
  1002. X
  1003. X/*****************************************************************/
  1004. X/*    The following initializes the structure arrays             */
  1005. X/*   needed to provide the Fast Mem Size menu topic.             */
  1006. X/*****************************************************************/
  1007. X
  1008. Xvoid InitFastItems()
  1009. X    {
  1010. X    int       n,nplus1;
  1011. X
  1012. X/* initialize each menu item and IntuiText with loop */
  1013. Xfor( n=0; n<FASTMAX; n++ )
  1014. X    {
  1015. X    nplus1 = n + 1;
  1016. X    FastItem[n].NextItem = &FastItem[nplus1];
  1017. X    FastItem[n].LeftEdge = 0;
  1018. X    FastItem[n].TopEdge = 9 * n;
  1019. X    FastItem[n].Width = 80;
  1020. X    FastItem[n].Height = 9;
  1021. X    FastItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  1022. X    FastItem[n].MutualExclude = (~(1 << n));
  1023. X    FastItem[n].ItemFill = (APTR)&FastText[n];
  1024. X    FastItem[n].SelectFill = NULL;
  1025. X    FastItem[n].Command = 0;
  1026. X    FastItem[n].NextSelect = 0;
  1027. X
  1028. X    FastText[n].FrontPen = BLUP;
  1029. X    FastText[n].BackPen = WHTP;
  1030. X    FastText[n].DrawMode = JAM2;    
  1031. X    FastText[n].LeftEdge = 0;
  1032. X    FastText[n].TopEdge = 1;
  1033. X    FastText[n].ITextFont = NULL;
  1034. X    FastText[n].NextText = NULL;
  1035. X    }
  1036. XFastItem[FASTMAX-1].NextItem = NULL;
  1037. X
  1038. X/* select fast mem size item checked */
  1039. Xswitch (p_fast) {
  1040. X    case 0:       n = 0; break;
  1041. X    case 512:     n = 1; break;
  1042. X    case 1:       n = 2; break;
  1043. X    case 2:       n = 3; break;
  1044. X    case 4:       n = 4; break;
  1045. X    case 6:       n = 5; break;
  1046. X    case 8:       n = 6; break;
  1047. X    default:      n = 0; p_fast = 0;
  1048. X    }
  1049. XFastItem[n].Flags |= CHECKED;
  1050. X
  1051. XFastText[0].IText = (UBYTE *)"   NONE";
  1052. XFastText[1].IText = (UBYTE *)"   512K";
  1053. XFastText[2].IText = (UBYTE *)"   1 MB";
  1054. XFastText[3].IText = (UBYTE *)"   2 MB";
  1055. XFastText[4].IText = (UBYTE *)"   4 MB";
  1056. XFastText[5].IText = (UBYTE *)"   6 MB";
  1057. XFastText[6].IText = (UBYTE *)"   8 MB";
  1058. X}
  1059. X
  1060. X/*****************************************************************/
  1061. X/*    The following initializes the structure arrays             */
  1062. X/*   needed to provide the Fast Mem Base Addr menu topic.        */
  1063. X/*****************************************************************/
  1064. X
  1065. Xvoid InitFastAItems()
  1066. X    {
  1067. X    int       n,nplus1;
  1068. X
  1069. X/* initialize each menu item and IntuiText with loop */
  1070. Xfor( n=0; n<FASTAMAX; n++ )
  1071. X    {
  1072. X    nplus1 = n + 1;
  1073. X    FastAItem[n].NextItem = &FastAItem[nplus1];
  1074. X    FastAItem[n].LeftEdge = 0;
  1075. X    FastAItem[n].TopEdge = 9 * n;
  1076. X    FastAItem[n].Width = 80;
  1077. X    FastAItem[n].Height = 9;
  1078. X    FastAItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
  1079. X    FastAItem[n].MutualExclude = (~(1 << n));
  1080. X    FastAItem[n].ItemFill = (APTR)&FastAText[n];
  1081. X    FastAItem[n].SelectFill = NULL;
  1082. X    FastAItem[n].Command = 0;
  1083. X    FastAItem[n].NextSelect = 0;
  1084. X
  1085. X    FastAText[n].FrontPen = BLUP;
  1086. X    FastAText[n].BackPen = WHTP;
  1087. X    FastAText[n].DrawMode = JAM2;    
  1088. X    FastAText[n].LeftEdge = 0;
  1089. X    FastAText[n].TopEdge = 1;
  1090. X    FastAText[n].ITextFont = NULL;
  1091. X    FastAText[n].NextText = NULL;
  1092. X    }
  1093. XFastAItem[FASTAMAX-1].NextItem = NULL;
  1094. X
  1095. X/* select fast base address item checked */
  1096. Xswitch (p_fasta) {
  1097. X    case 2:     n = 0; break;
  1098. X    case 3:     n = 1; break;
  1099. X    case 4:     n = 2; break;
  1100. X    case 5:     n = 3; break;
  1101. X    case 6:     n = 4; break;
  1102. X    case 7:     n = 5; break;
  1103. X    case 8:     n = 6; break;
  1104. X    case 9:     n = 7; break;
  1105. X    default:    n = 0; p_fasta = 2;
  1106. X    }
  1107. XFastAItem[n].Flags |= CHECKED;
  1108. X
  1109. XFastAText[0].IText = (UBYTE *)"   @ 2 M";
  1110. XFastAText[1].IText = (UBYTE *)"   @ 3 M";
  1111. XFastAText[2].IText = (UBYTE *)"   @ 4 M";
  1112. XFastAText[3].IText = (UBYTE *)"   @ 5 M";
  1113. XFastAText[4].IText = (UBYTE *)"   @ 6 M";
  1114. XFastAText[5].IText = (UBYTE *)"   @ 7 M";
  1115. XFastAText[6].IText = (UBYTE *)"   @ 8 M";
  1116. XFastAText[7].IText = (UBYTE *)"   @ 9 M";
  1117. X}
  1118. X
  1119. X/****************************************************************/
  1120. X/*   The following function inits the Menu structure array with */
  1121. X/*  appropriate values for our simple menu.  Review the manual  */
  1122. X/*  if you need to know what each value means.                  */
  1123. X/****************************************************************/
  1124. Xvoid InitMenu()
  1125. X{
  1126. Xmenu[0].NextMenu = &menu[1];
  1127. Xmenu[0].LeftEdge = 0;
  1128. Xmenu[0].TopEdge = 0;
  1129. Xmenu[0].Width = 64;
  1130. Xmenu[0].Height = 10;
  1131. Xmenu[0].Flags = MENUENABLED;
  1132. Xmenu[0].MenuName = "Project";        /* text for menu-bar display */
  1133. Xmenu[0].FirstItem = &ProjItem[0];    /* pointer to first item in list */
  1134. X
  1135. Xmenu[1].NextMenu = &menu[2];
  1136. Xmenu[1].LeftEdge = 64;
  1137. Xmenu[1].TopEdge = 0;
  1138. Xmenu[1].Width = 48;
  1139. Xmenu[1].Height = 10;
  1140. Xmenu[1].Flags = MENUENABLED;
  1141. Xmenu[1].MenuName = "Setup";          /* text for menu-bar display */
  1142. Xmenu[1].FirstItem = &SetupItem[0];   /* pointer to first item in list */
  1143. X
  1144. Xmenu[2].NextMenu = &menu[3];
  1145. Xmenu[2].LeftEdge = 112;
  1146. Xmenu[2].TopEdge = 0;
  1147. Xmenu[2].Width = 72;
  1148. Xmenu[2].Height = 10;
  1149. Xmenu[2].Flags = MENUENABLED;
  1150. Xmenu[2].MenuName = "Priority";       /* text for menu-bar display */
  1151. Xmenu[2].FirstItem = &PrioItem[0];    /* pointer to first item in list */
  1152. X
  1153. Xmenu[3].NextMenu = &menu[4];
  1154. Xmenu[3].LeftEdge = 184;
  1155. Xmenu[3].TopEdge = 0;
  1156. Xmenu[3].Width = 80;
  1157. Xmenu[3].Height = 10;
  1158. Xmenu[3].Flags = MENUENABLED;
  1159. Xmenu[3].MenuName = "Chip Size";      /* text for menu-bar display */
  1160. Xmenu[3].FirstItem = &ChipItem[0];    /* pointer to first item in list */
  1161. X
  1162. Xmenu[4].NextMenu = &menu[5];
  1163. Xmenu[4].LeftEdge = 264;
  1164. Xmenu[4].TopEdge = 0;
  1165. Xmenu[4].Width = 80;
  1166. Xmenu[4].Height = 10;
  1167. Xmenu[4].Flags = MENUENABLED;
  1168. Xmenu[4].MenuName = "Chip Addr";      /* text for menu-bar display */
  1169. Xmenu[4].FirstItem = &ChipAItem[0];   /* pointer to first item in list */
  1170. X
  1171. Xmenu[5].NextMenu = &menu[6];
  1172. Xmenu[5].LeftEdge = 344;
  1173. Xmenu[5].TopEdge = 0;
  1174. Xmenu[5].Width = 64;
  1175. Xmenu[5].Height = 10;
  1176. Xmenu[5].Flags = MENUENABLED;
  1177. Xmenu[5].MenuName = "SF Size";        /* text for menu-bar display */
  1178. Xmenu[5].FirstItem = &SFItem[0];      /* pointer to first item in list */
  1179. X
  1180. Xmenu[6].NextMenu = &menu[7];
  1181. Xmenu[6].LeftEdge = 408;
  1182. Xmenu[6].TopEdge = 0;
  1183. Xmenu[6].Width = 64;
  1184. Xmenu[6].Height = 10;
  1185. Xmenu[6].Flags = MENUENABLED;
  1186. Xmenu[6].MenuName = "SF Addr";        /* text for menu-bar display */
  1187. Xmenu[6].FirstItem = &SFAItem[0];     /* pointer to first item in list */
  1188. X
  1189. Xmenu[7].NextMenu = &menu[8];
  1190. Xmenu[7].LeftEdge = 472;
  1191. Xmenu[7].TopEdge = 0;
  1192. Xmenu[7].Width = 80;
  1193. Xmenu[7].Height = 10;
  1194. Xmenu[7].Flags = MENUENABLED;
  1195. Xmenu[7].MenuName = "Fast Size";      /* text for menu-bar display */
  1196. Xmenu[7].FirstItem = &FastItem[0];    /* pointer to first item in list */
  1197. X
  1198. Xmenu[8].NextMenu = NULL;
  1199. Xmenu[8].LeftEdge = 552;
  1200. Xmenu[8].TopEdge = 0;
  1201. Xmenu[8].Width = 80;
  1202. Xmenu[8].Height = 10;
  1203. Xmenu[8].Flags = MENUENABLED;
  1204. Xmenu[8].MenuName = "Fast Addr";      /* text for menu-bar display */
  1205. Xmenu[8].FirstItem = &FastAItem[0];   /* pointer to first item in list */
  1206. X
  1207. X}
  1208. X
  1209. Xvoid StartMenus()
  1210. X{
  1211. XSetMenuStrip(window,&menu[0]);
  1212. X}
  1213. END_OF_FILE
  1214. if test 23918 -ne `wc -c <'mminit.c'`; then
  1215.     echo shar: \"'mminit.c'\" unpacked with wrong size!
  1216. fi
  1217. # end of 'mminit.c'
  1218. fi
  1219. echo shar: End of archive 1 \(of 2\).
  1220. cp /dev/null ark1isdone
  1221. MISSING=""
  1222. for I in 1 2 ; do
  1223.     if test ! -f ark${I}isdone ; then
  1224.     MISSING="${MISSING} ${I}"
  1225.     fi
  1226. done
  1227. if test "${MISSING}" = "" ; then
  1228.     echo You have unpacked both archives.
  1229.     rm -f ark[1-9]isdone
  1230. else
  1231.     echo You still need to unpack the following archives:
  1232.     echo "        " ${MISSING}
  1233. fi
  1234. ##  End of shell archive.
  1235. exit 0
  1236. -- 
  1237. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  1238. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  1239. Post requests for sources, and general discussion to comp.sys.amiga.
  1240.